<template>
	<!-- 地址管理 -->
	<view class="content">
			<view class="item" v-for="(item, index) in list" :key="index">
				<view class="txt">
					<text class="name">{{item.receiver}}</text><text>{{item.tel}}</text><text class="def" v-if="item.isDefault==1">(默认)</text>
				</view>
				<view class="txt">
					{{item.address}}
				</view>
				<image @click="lookDetail(item.id)" src="../../../../static/img/my/address/update.png"></image>
			</view>
			<view class="noMore" v-show="isNoMore">暂无更多数据...</view>
		<view class="button" @click="toAdd">+添加地址</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			isNoMore:false,
			list:[]
		};
	},
	methods: {
		
	},
	onLoad() {
		let opts = {
			url: 'myUserAddress/list',
			method: 'get'
		};
		let param = {};
		this.tokenRequest(opts, param).then(res => {
			uni.hideLoading();
			let rData = res.data;
			if(rData.length == 0){
				uni.showToast({
					title: '暂无更多数据...',
					mask: true,
					icon: 'none',
					duration: 1500
				})
				this.isNoMore = true;
				return;
			}
			this.list = rData;
		}, error => {})
		
	},onShow() {
		
	},methods:{
		toAdd(){
			uni.redirectTo({
				url: 'detail'
			});
		},
		lookDetail(id){
			uni.redirectTo({
				url: 'detail?id='+id
			})
		}
	}
};
</script>

<style scoped>
	
	.content{
		padding-bottom: 150upx;
	}
	.item image{
		width: 50upx;
		height: 50upx;
		position: absolute;
		top: 10upx;
		right: 10upx;
	}
	.content{
		font-size: 30upx;
	}
	.item{
		background-color: #fff;
		padding: 20upx;
		margin: 20upx;
		border-radius: 10upx;
		position: relative;
	}
	.txt{
		margin: 10upx;
	}
	.name{
		margin-right: 20upx;
		font-weight: 800;
	}
	.def{
		font-weight: 800;
	}
	.button {
		width: 600upx;
		line-height: 100upx;
		margin-bottom: 30upx;
		margin-left: 75upx;
		background-color: #e98f36;
		color: #ffffff;
		text-align: center;
		border-radius: 10rpx;
		position: fixed;
		bottom: 0;
	}
</style>
